To determine the minimum size of the TLB tag, let's break down the problem step by step.
1. Understand the Virtual Address Structure
The CPU generates 32-bit virtual addresses.
The page size is 4 KB, which means the offset within a page is determined by the lower bits of the virtual address.
2. Calculate the Number of Offset Bits
Page size = 4 KB = 212 bytes.
The offset within a page is determined by the lower 12 bits of the virtual address.
3. Calculate the Number of Virtual Page Number (VPN) Bits
Total virtual address bits = 32.
Offset bits = 12.
VPN bits = Total bits - Offset bits = 32−12=20 bits.
4. Understand the TLB StructureThe TLB is 4-way set associative, meaning there are 4 entries per set.
The TLB can hold a total of 128 page table entries.
Number of sets = Total entries / Associativity = 128/4=32 sets.
5. Calculate the Number of Set Index Bits
Number of sets = 32 = 25.
The set index is determined by the lower 5 bits of the VPN.
6. Calculate the Number of Tag Bits
VPN bits = 20.
Set index bits = 5.
Tag bits = VPN bits - Set index bits = 20−5=15 bits.
7. Final Answer
The minimum size of the TLB tag is 15 bits.